package com.yykj.hospital.server.model.repository;

import com.yykj.hospital.server.model.entity.HospitalLabel;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by chendg
 * on 2021/10/31 0031.
 */
@Repository
public interface HospitalLabelRepository extends JpaRepository<HospitalLabel,Integer>,JpaSpecificationExecutor<HospitalLabel>{
    Page<HospitalLabel> findAllByHospitalIdOrderBySorting(Integer hospitalId,Pageable pageable);
    Page<HospitalLabel> findAllByHospitalIdAndNameLikeOrderBySorting(Integer hospitalId,String name,Pageable pageable);

    HospitalLabel findFirstByHospitalIdAndName(Integer hospitalId,String name);

    List<HospitalLabel> findAllByHospitalId(Integer hospitalId);
    List<HospitalLabel> findAllByHospitalIdOrderBySorting(Integer hospitalId);

}
